 testDiagonal();



function testDiagonal(){
	var mat = [
	[5,2,1],
	[2,3,3],
	[2,1,1]];
	
	var diagon=new Array();
	for (i=0; i<mat.length; i++){
		diagon.push(mat[i][i]);
		
		document.write(mat[i][i] + "<br/>");
	}
	
	var sum=0;
	for (i=0; i<diagon.length; i++){
		sum=sum+diagon[i];
	}	
	document.write("<b>"+sum+"</b>");

}